
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>界面交互 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="request.html" />
    
    
    <link rel="prev" href="basic.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../introduction/environment.html">
            
                <a href="../introduction/environment.html">
            
                    
                    环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../introduction/hello.html">
            
                <a href="../introduction/hello.html">
            
                    
                    HelloWorld
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../introduction/dev-and-debug.html">
            
                <a href="../introduction/dev-and-debug.html">
            
                    
                    开发与调试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../framework/file.html">
            
                <a href="../framework/file.html">
            
                    
                    文件组织
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../framework/manifest.html">
            
                <a href="../framework/manifest.html">
            
                    
                    manifest文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../framework/nml.html">
            
                <a href="../framework/nml.html">
            
                    
                    nml文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../framework/page.html">
            
                <a href="../framework/page.html">
            
                    
                    页面与组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../component/general.html">
            
                <a href="../component/general.html">
            
                    
                    通用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../component/container.html">
            
                <a href="../component/container.html">
            
                    
                    容器组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../component/basics.html">
            
                <a href="../component/basics.html">
            
                    
                    基础组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../component/form.html">
            
                <a href="../component/form.html">
            
                    
                    表单组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../component/media.html">
            
                <a href="../component/media.html">
            
                    
                    媒体组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    接口
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="general.html">
            
                <a href="general.html">
            
                    
                    通用规则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="basic.html">
            
                <a href="basic.html">
            
                    
                    基本功能
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.3" data-path="interface.html">
            
                <a href="interface.html">
            
                    
                    界面交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="request.html">
            
                <a href="request.html">
            
                    
                    网络访问
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="storage.html">
            
                <a href="storage.html">
            
                    
                    文件数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="system.html">
            
                <a href="system.html">
            
                    
                    系统能力
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="media.html">
            
                <a href="media.html">
            
                    
                    图形图像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="share.html">
            
                <a href="share.html">
            
                    
                    分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="pay.html">
            
                <a href="pay.html">
            
                    
                    支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="stat.html">
            
                <a href="stat.html">
            
                    
                    统计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >界面交互</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x754C;&#x9762;&#x4EA4;&#x4E92;">&#x754C;&#x9762;&#x4EA4;&#x4E92;</h2>
<h3 id="&#x5206;&#x4EAB;">&#x5206;&#x4EAB;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot;system.share&quot;}</p>
<h4 id="unishareshareobject">uni.share.share(OBJECT)</h4>
<p>&#x5206;&#x4EAB;&#x6570;&#x636E;&#x5230;&#x5176;&#x4ED6;app&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">type</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x6570;&#x636E;&#x7684;MIME TYPE&#xFF0C;&#x8981;&#x6C42;&#x5B57;&#x6BCD;&#x5168;&#x5C0F;&#x5199;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">data</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7684;&#x6570;&#x636E;</td>
</tr>
<tr>
<td style="text-align:left">success</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6210;&#x529F;&#x56DE;&#x8C03;&#x3002;&#x56E0;&#x4E3A;&#x5927;&#x90E8;&#x5206; android app &#x90FD;&#x6CA1;&#x6709;&#x6B63;&#x786E;&#x7684;&#x8FD4;&#x56DE;&#x5206;&#x4EAB;&#x72B6;&#x6001;&#xFF0C;&#x6240;&#x4EE5;&#x5373;&#x4F7F;&#x5206;&#x4EAB;&#x6210;&#x529F;&#x4E86;&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;&#x6267;&#x884C;cancel&#x56DE;&#x8C03;&#xFF0C;&#x800C;&#x4E0D;&#x662F;success&#x56DE;&#x8C03;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">fail</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5931;&#x8D25;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">cancel</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x53D6;&#x6D88;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">complete</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6267;&#x884C;&#x7ED3;&#x675F;&#x540E;&#x7684;&#x56DE;&#x8C03;</td>
</tr>
</tbody>
</table>
<p>data &#x7684;&#x503C;</p>
<ul>
<li>&#x5982;&#x679C; type &#x662F; text/ &#x5F00;&#x5934;&#x7684; mimetype&#xFF08;&#x5982; text/plain&#xFF09;&#xFF0C;&#x5219; data &#x662F;&#x8981;&#x5206;&#x4EAB;&#x7684;&#x6587;&#x672C;&#x5185;&#x5BB9;</li>
<li>&#x5982;&#x679C; type &#x662F;&#x5176;&#x4ED6;&#x503C;&#xFF0C;&#x5219; data &#x662F;&#x8981;&#x5206;&#x4EAB;&#x7684;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
</ul>
<p>&#x652F;&#x6301;&#x4E09;&#x79CD;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#xFF1A;</p>
<ul>
<li>&#x901A;&#x8FC7; uni.fetch.fetch &#x4E0B;&#x8F7D;&#x7684;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
<li>&#x901A;&#x8FC7; uni.file.save &#x6216; list &#x83B7;&#x5F97;&#x7684;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
<li>&#x4EE5; / &#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x5BB9;&#x7684;&#x8D44;&#x6E90;&#x6587;&#x4EF6;</li>
</ul>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.share.share({
  type: <span class="hljs-string">&quot;text/html&quot;</span>,
  data: <span class="hljs-string">&quot;&lt;b&gt;bold&lt;/b&gt;&quot;</span>,
  success: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data</span>) </span>{ <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling success&quot;</span>); },
  fail: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data, code</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling fail, code=&quot;</span> + code);
  }
});
</code></pre>
<h3 id="&#x5F39;&#x7A97;">&#x5F39;&#x7A97;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot;system.prompt&quot;}</p>
<h4 id="unipromptshowtoastobject">uni.prompt.showToast(OBJECT)</h4>
<p>&#x663E;&#x793A;Toast&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">message</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8981;&#x663E;&#x793A;&#x7684;&#x6587;&#x672C;</td>
</tr>
<tr>
<td style="text-align:left">duration</td>
<td style="text-align:left">Number</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">0&#x4E3A;&#x77ED;&#x65F6;&#xFF0C;1&#x4E3A;&#x957F;&#x65F6;&#xFF0C;&#x9ED8;&#x8BA4;0&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.prompt.showToast({
  message: <span class="hljs-string">&apos;message&apos;</span>
});
</code></pre>
<h4 id="unipromptshowdialogobject">uni.prompt.showDialog(OBJECT)</h4>
<p>&#x663E;&#x793A;&#x5BF9;&#x8BDD;&#x6846;&#x3002;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">title</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6807;&#x9898;</td>
</tr>
<tr>
<td style="text-align:left">message</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5185;&#x5BB9;</td>
</tr>
<tr>
<td style="text-align:left">buttons</td>
<td style="text-align:left">Array</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6309;&#x94AE;&#x7684;&#x6570;&#x7EC4;</td>
</tr>
<tr>
<td style="text-align:left">success</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6210;&#x529F;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">cancel</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x53D6;&#x6D88;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">complete</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6267;&#x884C;&#x7ED3;&#x675F;&#x540E;&#x7684;&#x56DE;&#x8C03;</td>
</tr>
</tbody>
</table>
<p>buttons</p>
<ul>
<li>&#x7ED3;&#x6784; <code>{text: &apos;text&apos;, color: &apos;#333333&apos;}</code>&#xFF0C;color &#x53EF;&#x9009;&#x3002;</li>
<li>&#x7B2C;1&#x9879;&#x4E3A; positive button</li>
<li>&#x7B2C;2&#x9879;&#xFF08;&#x5982;&#x679C;&#x6709;&#xFF09;&#x4E3A; negative button</li>
<li>&#x7B2C;3&#x9879;&#xFF08;&#x5982;&#x679C;&#x6709;&#xFF09;&#x4E3A; neutral button</li>
<li>&#x6700;&#x591A;&#x652F;&#x6301;3&#x4E2A; button
```</li>
</ul>
<p>success&#x8FD4;&#x56DE;&#x503C;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">index</td>
<td style="text-align:left">Number</td>
<td style="text-align:left">&#x9009;&#x4E2D;&#x6309;&#x94AE;&#x5728; buttons &#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x5E8F;&#x53F7;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.prompt.showDialog({
  title: <span class="hljs-string">&apos;title&apos;</span>,
  message: <span class="hljs-string">&apos;message&apos;</span>,
  buttons: [
    {
      text: <span class="hljs-string">&apos;btn&apos;</span>,
      color: <span class="hljs-string">&apos;#33dd44&apos;</span>
    }
  ],
  success: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling callback&quot;</span>);
  },
  fail: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data, code</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling fail, code=&quot;</span> + code);
  }
});
</code></pre>
<h4 id="unipromptshowcontextmenuobject">uni.prompt.showContextMenu(OBJECT)</h4>
<p>&#x663E;&#x793A;&#x4E0A;&#x4E0B;&#x6587;&#x83DC;&#x5355;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">itemList</td>
<td style="text-align:left">Array</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x6309;&#x94AE;&#x7684;&#x6587;&#x5B57;&#x6570;&#x7EC4;</td>
</tr>
<tr>
<td style="text-align:left">itemColor</td>
<td style="text-align:left">HexColor</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6309;&#x94AE;&#x989C;&#x8272;</td>
</tr>
<tr>
<td style="text-align:left">success</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6210;&#x529F;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">cancel</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x53D6;&#x6D88;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">complete</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6267;&#x884C;&#x7ED3;&#x675F;&#x540E;&#x7684;&#x56DE;&#x8C03;</td>
</tr>
</tbody>
</table>
<p>success&#x8FD4;&#x56DE;&#x503C;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">index</td>
<td style="text-align:left">Number</td>
<td style="text-align:left">&#x9009;&#x4E2D;&#x6309;&#x94AE;&#x5728; itemList &#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x5E8F;&#x53F7;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.prompt.showContextMenu({
  itemList: [<span class="hljs-string">&apos;item1&apos;</span>, <span class="hljs-string">&apos;item2&apos;</span>],
  itemColor: <span class="hljs-string">&apos;#ff33ff&apos;</span>,
  success: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling callback&quot;</span>);
  },
  fail: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">data, code</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling fail, code=&quot;</span> + code);
  }
});
</code></pre>
<h3 id="&#x6253;&#x5F00;&#x7F51;&#x9875;">&#x6253;&#x5F00;&#x7F51;&#x9875;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot;system.webview&quot;}</p>
<h4 id="uniwebviewloadurlobject">uni.webview.loadUrl(OBJECT)</h4>
<p>&#x6253;&#x5F00;&#x7F51;&#x9875;&#xFF0C;&#x6807;&#x9898;&#x680F;&#x6837;&#x5F0F;&#x4E0E;&#x6253;&#x5F00;webview&#x7684;&#x9875;&#x9762;&#x7684;&#x6807;&#x9898;&#x680F;&#x6837;&#x5F0F;&#x76F8;&#x540C;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">url</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8981;&#x52A0;&#x8F7D;&#x7684;&#x9875;&#x9762;url</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.webview.loadUrl({
  url: <span class="hljs-string">&apos;http://www.example.com&apos;</span>
});
</code></pre>
<h4 id="unisystemgopath">uni.system.go(path)</h4>
<p>WebView &#x5185;&#x90E8; API&#xFF0C;&#x5728; Webview &#x6253;&#x5F00;&#x7684;&#x7F51;&#x9875;&#x4E2D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7684; API&#x3002;&#x8DF3;&#x8F6C;&#x5230;&#x5F53;&#x524D;&#x5E94;&#x7528;&#x7684;&#x6307;&#x5B9A;&#x9875;&#x9762;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">path</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x8981;&#x8FD4;&#x56DE;&#x7684;&#x9875;&#x9762;&#x3002;&#x4F8B;&#xFF1A;<code>/detail?param1=value1</code> &#x7279;&#x6B8A;&#x7684;&#xFF0C;&#x5982;&#x679C; path &#x7684;&#x503C;&#x662F;&quot;/&quot;&#xFF0C;&#x5219;&#x8DF3;&#x8F6C;&#x5230; path &#x4E3A;&quot;/&quot;&#x7684;&#x9875;&#xFF0C;&#x6CA1;&#x6709;&#x5219;&#x8DF3;&#x8F6C;&#x5230;&#x9996;&#x9875;&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.system.go(<span class="hljs-string">&quot;/detail?param1=value1&quot;</span>);
</code></pre>
<h3 id="&#x901A;&#x77E5;&#x6D88;&#x606F;">&#x901A;&#x77E5;&#x6D88;&#x606F;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot;system.notification&quot;}</p>
<h4 id="uninotificationshowobject">uni.notification.show(OBJECT)</h4>
<p>&#x663E;&#x793A;&#x901A;&#x77E5;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">contentTitle</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6807;&#x9898;</td>
</tr>
<tr>
<td style="text-align:left">contentText</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5185;&#x5BB9;</td>
</tr>
<tr>
<td style="text-align:left">clickAction</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x901A;&#x77E5;&#x70B9;&#x51FB;&#x540E;&#x89E6;&#x53D1;&#x52A8;&#x4F5C;&#x7684;&#x4FE1;&#x606F;</td>
</tr>
</tbody>
</table>
<p>clickAction &#x8BF4;&#x660E;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">uri</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x70B9;&#x51FB;&#x901A;&#x77E5;&#x540E;&#x8DF3;&#x8F6C;&#x7684;&#x9875;&#x9762;&#x5730;&#x5740;&#x3002;</td>
</tr>
</tbody>
</table>
<p>uri &#x652F;&#x6301;&#x7684;&#x683C;&#x5F0F;</p>
<ul>
<li>&#x4EE5;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x8DEF;&#x5F84;&#x3002;&#x5982;&#xFF1A;<code>/about</code></li>
<li>&#x4EE5;&#x975E;&quot;/&quot;&#x5F00;&#x5934;&#x7684;&#x5E94;&#x7528;&#x5185;&#x9875;&#x9762;&#x7684;&#x540D;&#x79F0;&#x3002;&#x5982;&#xFF1A;<code>About</code></li>
<li>&#x7279;&#x6B8A;&#x7684;&#xFF0C;&#x5982;&#x679C;uri&#x7684;&#x503C;&#x662F;&quot;/&quot;&#xFF0C;&#x5219;&#x8DF3;&#x8F6C;&#x5230; path &#x4E3A;&quot;/&quot;&#x7684;&#x9875;&#xFF0C;&#x6CA1;&#x6709;&#x5219;&#x8DF3;&#x8F6C;&#x5230;&#x9996;&#x9875;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&quot;?param1=value1&quot;&#x7684;&#x65B9;&#x5F0F;&#x6DFB;&#x52A0;&#x53C2;&#x6570;&#xFF0C;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x5728;&#x9875;&#x9762;&#x4E2D;&#x901A;&#x8FC7; <code>this.param1</code> &#x7684;&#x65B9;&#x5F0F;&#x4F7F;&#x7528;&#x3002;</li>
</ul>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.notification.show({
  contentTitle: <span class="hljs-string">&apos;title&apos;</span>,
  clickAction: {
    uri: <span class="hljs-string">&apos;/index.html?index=1&apos;</span>
  }
});
</code></pre>
<h3 id="&#x9707;&#x52A8;">&#x9707;&#x52A8;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot;system.vibrator&quot;}</p>
<h4 id="univibratorvibrate">uni.vibrator.vibrate()</h4>
<p>&#x89E6;&#x53D1;&#x9707;&#x52A8;&#xFF0C;&#x6301;&#x7EED;1&#x79D2;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x793A;&#x4F8B;</p>
<pre><code>uni.vibrator.vibrate()
</code></pre><h3 id="&#x6D88;&#x606F;&#x901A;&#x9053;">&#x6D88;&#x606F;&#x901A;&#x9053;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>&#x65E0;&#x9700;&#x58F0;&#x660E;&#x3002;</p>
<h4 id="unichannelsubscribeobject">uni.channel.subscribe(OBJECT)</h4>
<p>&#x76D1;&#x542C;&#x6D88;&#x606F;&#x901A;&#x9053;&#xFF0C;&#x540C;&#x4E00;&#x4E2A;&#x9875;&#x9762;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x901A;&#x9053;&#x591A;&#x6B21;&#x8C03;&#x7528;&#xFF0C;&#x4EC5;&#x6700;&#x540E;&#x4E00;&#x6B21;&#x8C03;&#x7528;&#x751F;&#x6548;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x901A;&#x9053;&#x540D;&#x79F0;</td>
</tr>
<tr>
<td style="text-align:left">callback</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x6BCF;&#x6B21;&#x6709;&#x65B0;&#x6D88;&#x606F;&#xFF0C;&#x90FD;&#x4F1A;&#x88AB;&#x56DE;&#x8C03;&#x3002;</td>
</tr>
</tbody>
</table>
<p>callback &#x8FD4;&#x56DE;&#x503C;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">message</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x6D88;&#x606F;&#x5185;&#x5BB9;</td>
</tr>
<tr>
<td style="text-align:left">source</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x6D88;&#x606F;&#x6765;&#x6E90;&#x9875;&#x9762;&#x7684;&#x8DEF;&#x5F84;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code>uni.channel.subscribe({
  name: &quot;channel-1&quot;,
  callback: function (data) {
    console.log(&quot;handling success: &quot; + data.message);
  }
});
</code></pre><h4 id="unichannelunsubscribe">uni.channel.unsubscribe()</h4>
<p>&#x53D6;&#x6D88;&#x76D1;&#x542C;&#x6D88;&#x606F;&#x901A;&#x9053;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x901A;&#x9053;&#x540D;&#x79F0;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code>uni.channel.unsubscribe(&quot;channel-1&quot;)
</code></pre><h4 id="unichannelpostmessageobject">uni.channel.postMessage(OBJECT)</h4>
<p>&#x5411;&#x6D88;&#x606F;&#x901A;&#x9053;&#x53D1;&#x6D88;&#x606F;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x901A;&#x9053;&#x540D;&#x79F0;</td>
</tr>
<tr>
<td style="text-align:left">message</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x6D88;&#x606F;&#x5185;&#x5BB9;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code>uni.channel.postMessage({
  name: &quot;channel-1&quot;,
  message: &quot;message-1&quot;
});
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="basic.html" class="navigation navigation-prev " aria-label="Previous page: 基本功能">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="request.html" class="navigation navigation-next " aria-label="Next page: 网络访问">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"界面交互","level":"1.5.3","depth":2,"next":{"title":"网络访问","level":"1.5.4","depth":2,"path":"api/request.md","ref":"api/request.md","articles":[]},"previous":{"title":"基本功能","level":"1.5.2","depth":2,"path":"api/basic.md","ref":"api/basic.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"api/interface.md","mtime":"2018-02-21T02:14:06.357Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-04T08:24:24.953Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

